<%@ page contentType="text/html;charset=UTF-8"  %>

<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title>个人管理</title>
    <link rel="stylesheet" href="../../admin/css/pintuer.css">
    <link rel="stylesheet" href="../../admin/css/admin.css">
    <script src="https://cdn.bootcss.com/jquery/1.11.1/jquery.js"></script>
    <script src="../../admin/js/pintuer.js"></script>
    <script>
        // 图片上传后预览
        function Uploadpicture() {
            $("#File").trigger("click");
        }

        function changepic(f) {
            var rd = new FileReader();
            var files = f.files[0];
            rd.readAsDataURL(files);
            rd.onloadend = function (ev) {
                var url1 = document.getElementById("url1");
                url1.setAttribute("data-image", this.result);
                var fliename = document.getElementById("File").value;
                $("#url1").val(fliename);
            }
        }
    </script>
</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head"><strong><span class="icon-key"></span> 修改个人信息 </strong></div>
    <div class="body-content">
        <form method="post" class="form-x" action="${pageContext.request.contextPath}/UserServlet?method=updateUser" enctype="multipart/form-data">

            <div class="form-group">
                <div class="label">
                    <label>管理员名称:</label>
                </div>
                <div class="field">
                    <input type="text" class="input w50" size="50" name="userName" placeholder="${sessionScope.user.userName}"
                           data-validate="required:请输入管理员名称"/>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label>头像图片：</label>
                </div>
                <div class="field">
                    <input type="text" id="url1" name="img" class="input tips" style="width:25%; float:left;"
                           data-toggle="hover" data-place="right" data-image="${pageContext.request.contextPath}/${sessionScope.user.picPath}?random=${randomNum}"/>
                    <input type="file" style="display: none" id="File" name="pic" onchange="changepic(this)">
                    <input type="button" class="button bg-blue margin-left" id="image1" value="+ 浏览上传"
                           style="float:left;" onclick="Uploadpicture();">
                    <div class="tipss">图片尺寸：1920*500</div>
                </div>
            </div>

            <div class="form-group">
                <div class="label">
                    <label></label>
                </div>
                <div class="field">
                    <button class="button bg-main icon-check-square-o" type="submit"> 提交</button>
                </div>
            </div>
        </form>
    </div>
</div>

</body>
</html>

